package com.linln.admin.membernotice.controller;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.linln.common.utils.ResultVoUtil;
import com.linln.common.vo.ResultVo;
import com.linln.modules.member.service.MembernoticeService;

/**
 * @author hct
 * @date 2019/10/11
 */
@Controller
@RequestMapping("/membernotice/membernotice")
public class MembernoticeController {

    @Autowired
    private MembernoticeService membernoticeService;

    /**
     * 设置一条或者多条数据的状态
     */
    @RequestMapping("/status/{param}")
    @RequiresPermissions("membernotice:membernotice:status")
    @ResponseBody
    public ResultVo status(
            @PathVariable("param") String param,
            @RequestParam(value = "ids", required = false) List<Long> ids) {
        // 更新状态
        if (membernoticeService.updateStatus(1, ids)) {
            return ResultVoUtil.success("成功");
        } else {
            return ResultVoUtil.error("失败，请重新操作");
        }
    }
}